package com.gdhuarui.mapper;

import com.gdhuarui.pojo.*;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;

@Repository
public interface IndexMapper {

    @Select({"select * from `config`"})
    ArrayList<Config> getConfigs();

    @Select({"select * from `news` where catalog = #{catalog} order by id DESC limit 6"})
    Page<News> getNewsByCatalog(String catalog);

    @Select({"select * from `project` order by id DESC limit 6"})
    Page<Project> getProjectsLimitSix();

    @Select({"select * from `partner` order by id DESC limit 6"})
    Page<Partner> getPartnerslimitSix();

    @Select({"select * from `news` where catalog = #{catalog} order by id DESC"})
    Page<News> getNewsByCatalogPage(String catalog);

    @Select({"select * from `news` where id = #{id}"})
    News getNewsById(int id);

    @Select({"select * from `project` order by id DESC"})
    Page<Project> getProjectsPage();

    @Select({"select * from `product` order by id DESC"})
    Page<Product> getProductsPage();

    @Select({"select * from `product` where id = #{id}"})
    Product getProductById(int id);
}
